package com.ddatsh.transaction.core.model;

import java.util.Date;

/**
 * 交易系统响应对像，改模型将返回响应结果给最终用户，改模型包含了响应需要的各种数据，该模型包含的responseNo将对应
 * {@link com.ddatsh.transaction.core.model.Request#getRequestNo()}
 * 而且完全相同，transNo（如果有值）将对应
 * {@link com.ddatsh.transaction.core.model.Request#getRequestNo()}而且完全相同
 * 
 * @author ddatsh
 * 
 * @version 1.0
 */
public class Response implements java.io.Serializable {

	private static final long serialVersionUID = 4317519214944173965L;
	public static final String STATUS_INIT = "000";
	public static final String STATUS_COMPLETE = "100";
	// 响应流水号
	private String responseNo;
	// 事务流水号
	private String transactionNo;
	// 渠道代码
	private String channelCode;
	// 交易类型
	private String transType;
	// 响应主体
	private Object responseBody;
	// 响应主体JSON
	private String responseBodyJson;
	// 响应时间
	private Date responseTime;
	// 处理耗时（不计网络耗时）
	private Long costTime;
	// 响应错误代码
	private String errorCode;
	// 响应异常信息
	private String errorMsg;
	// 状态
	private String status;

	public Response() {
		super();
	}

	public Response(Request request) {
		super();
		this.responseNo = request.getRequestNo();
		this.transactionNo = request.getTransactionNo();
		this.channelCode = request.getChannelCode();
		this.transType = request.getTransType();
		this.responseTime = new Date();
		this.status = STATUS_INIT;
	}

	public String getResponseNo() {
		return responseNo;
	}

	public String getTransactionNo() {
		return transactionNo;
	}

	public String getChannelCode() {
		return channelCode;
	}

	public String getTransType() {
		return transType;
	}

	public Object getResponseBody() {
		return responseBody;
	}

	public String getResponseBodyJson() {
		return responseBodyJson;
	}

	public Date getResponseTime() {
		return responseTime;
	}

	public Long getCostTime() {
		return costTime;
	}

	public String getErrorCode() {
		return errorCode;
	}

	public String getErrorMsg() {
		return errorMsg;
	}

	public String getStatus() {
		return status;
	}

	public void setResponseNo(String responseNo) {
		this.responseNo = responseNo;
	}

	public void setTransactionNo(String transactionNo) {
		this.transactionNo = transactionNo;
	}

	public void setChannelCode(String channelCode) {
		this.channelCode = channelCode;
	}

	public void setTransType(String transType) {
		this.transType = transType;
	}

	public void setResponseBody(Object responseBody) {
		this.responseBody = responseBody;
	}

	public void setResponseBodyJson(String responseBodyJson) {
		this.responseBodyJson = responseBodyJson;
	}

	public void setResponseTime(Date responseTime) {
		this.responseTime = responseTime;
	}

	public void setCostTime(Long costTime) {
		this.costTime = costTime;
	}

	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}

	public void setErrorMsg(String errorMsg) {
		this.errorMsg = errorMsg;
	}

	public void setStatus(String status) {
		this.status = status;
	}

}
